//
//  HomeCommutyActivityOneView.m
//  LovingPartyBuilding
//
//  Created by 刘应平 on 17/4/28.
//  Copyright © 2017年 刘应平. All rights reserved.
//

#import "HomeCommutyActivityOneView.h"

@interface HomeCommutyActivityOneView ()
/**  title  */
@property (strong, nonatomic) UILabel  *titleLabel;
/**  detail  */
@property (strong, nonatomic) UILabel  *detailLabel;
/**  图片  */
@property (strong, nonatomic) UIImageView  *imageView;

@end
/**  170  */
@implementation HomeCommutyActivityOneView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self addSubview:self.titleLabel];
        [self addSubview:self.imageView];
        [self addSubview:self.detailLabel];
        
        self.titleLabel.sd_layout
        .topSpaceToView(self,11 * [UIScreen zj_screenHScale])
        .leftEqualToView(self).heightIs(13 * [UIScreen zj_screenHScale])
        .widthIs(self.width);
        
        self.detailLabel.sd_layout
        .bottomSpaceToView(self, 11 * [UIScreen zj_screenHScale])
        .heightIs(40 * [UIScreen zj_screenHScale])
        .leftEqualToView(self).widthIs(self.width);
        
        self.imageView.sd_layout
        .leftEqualToView(self).widthIs(self.width).topSpaceToView(self.titleLabel,8 * [UIScreen zj_screenHScale]).heightIs(93 * [UIScreen zj_screenHScale]);
    }
    return self;
}


//
- (void)setModel:(BranchOpenOrgDynimicModel *)model{
    _model = model;
    self.titleLabel.text = model.TITLE;
    self.detailLabel.text = model.ABSTRACT;
    [self.imageView sd_setImageWithURL:CREATEURL(model.COVERTHUMBURL) placeholderImage:PlaceholderImage];;
}

- (UILabel *)titleLabel{
    if (!_titleLabel) {
        _titleLabel = ({
            UILabel *label = [UILabel new];
            label.textAlignment = NSTextAlignmentLeft;
            label.textColor = [UIColor textBlackColor];
            label.backgroundColor = [UIColor clearColor];
            label.font = [UIFont systemFontOfSize:15 * [UIScreen zj_textFontScale]];
            label;
        });
    }
    return _titleLabel;
}

- (UILabel *)detailLabel{
    if (!_detailLabel) {
        _detailLabel = ({
            UILabel *label = [UILabel new];
            label.textAlignment = NSTextAlignmentLeft;
            label.numberOfLines = 2;
            label.textColor = [UIColor lightGrayColor];
            label.backgroundColor = [UIColor clearColor];
            label.font = [UIFont systemFontOfSize:12 * [UIScreen zj_textFontScale]];
            label;
        });
    }
    return _detailLabel;
}

- (UIImageView *)imageView{
    if (!_imageView) {
        _imageView = [UIImageView new];
        _imageView.contentMode = UIViewContentModeScaleToFill;
    }
    return _imageView;

}

@end
